//
//  TextFieldLeftView.m
//  YSSmartHome
//
//  Created by Yahaong on 16/8/16.
//  Copyright © 2016年 yahaong. All rights reserved.
//

#import "TextFieldLeftView.h"
#import "YHMarcros.h"

@implementation TextFieldLeftView

- (instancetype)initWithImage:(NSString *)image
{
    if (self = [super init]) {
        UIImage *im = [UIImage imageNamed:image];
        UIImageView *imageView = [[UIImageView alloc] initWithImage:im];
        [self addSubview:imageView];
        imageView.center = self.center;
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(self);
        }];
        UIView *line = [[UIView alloc]init];
        line.backgroundColor = kBgColor;
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.trailing.bottom.equalTo(self);
            make.width.equalTo(1);
        }];
    }
    return self;
    
}

- (instancetype)initWithView:(UIView *)view
{
    if (self = [super init]) {
        [self addSubview:view];
        [view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.center.equalTo(self);
        }];
        UIView *line = [[UIView alloc]init];
        line.backgroundColor = kBgColor;
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.trailing.bottom.equalTo(self);
            make.width.equalTo(1);
        }];
    }
    return self;
}

@end
